var mongoose = require('mongoose');

module.exports = function(){
	var models = {};
	
	models.user = mongoose.model('user', {
		username: String,
		password: String,
		service: String,
		email: String,
		points: Number,
		rank: Number,
		userLocation: String,
		birthday: Number,
		gender: String,
		picture: String,
		admin: Boolean
	});
	
	models.topic = mongoose.model('topic', {
		topicName: String,
		created: Number,
		createdBy: String
	});
	
	models.trend = mongoose.model('trend', {
		topicName: String,
		trendName: String,
		created: Number,
		createdBy: String,
		votes: Number,
		downvotes: Number,
		rss: String,
		imageSrc: String
	});
	
	models.votes = mongoose.model('votes', {
		topicName: {type: String, ref: 'trend'},
		created: {type: Number, ref: 'trend'},
		createdBy: {type: String, ref: 'trend'},
		votes: {type: Number, ref: 'trend'},
		downvotes: {type: Number, ref: 'trend'},
		trendName: {type: String},
		dateVoted: Number,
		votedBy: String,
		voted: Number
	});
	
	models.reports = mongoose.model('reports', {
		trendName: {type: String, ref: 'trend'},
		created: Number,
		createdBy: String,
		report: String
	});
	
	return models;
};